package cn.edu.hubu.javaparkinglot.controller;

import cn.edu.hubu.javaparkinglot.VO.ResultVO;
import cn.edu.hubu.javaparkinglot.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin(origins = "http://127.0.0.1:8848")
public class CarController {
    @Autowired
    private CarService carService;

    @RequestMapping("/car/select_carId")
    public ResultVO checkCarId(String carId){
        //调用CarService中checkCarId的业务进行验证
        ResultVO vo = carService.checkCarId(carId);
        return vo;

//         System.out.println("carId----check");
//         return null;
    }

    @RequestMapping("/car/select_seatId")
    public ResultVO checkSeatId(int seatId){
        //调用CarService中checkSeatId的业务进行验证
        ResultVO vo = carService.checkSeatId(seatId);
        return vo;
//        System.out.println("seatId----check");
//        return null;
    }
    @RequestMapping("/car/select_time")
    public ResultVO checkTime(
            @RequestParam("startTime") String startTime,
            @RequestParam("endTime") String endTime) {
        // 调用 CarService 中 checkTime 的业务进行验证
        ResultVO vo = carService.checkTime(startTime, endTime);
        return vo;
    }

}
